跳至主要内容

Backend Structure


前後端分離


前端 : 負責user看得到的部份

後端 : 負責user看不到的部份


  • 為前端提供資料
  • 資料庫
  • 底層業務邏輯實現
  • API實做
  • ...

API

application programming interface AKA 前端與後端溝通的管道


API : 服務生 Backend : 廚房


server會監聽來自 http://localhost:3000 ( 以這個project為例 )的http request,並做出對應的回應


使用http method送出http request


RESTful API

  • Get : 查找
  • Post : 新增
  • Patch : 更新
  • Delete : 刪除

http method : 動作 url : 目標


Get http://localhost:3000/helloWord

實做環節


git@github.com:Iittlefish/spyDog-Backend.git https://github.com/Iittlefish/spyDog-Backend.git


  1. 接收來自client端的request
  2. 根據不同的request呼叫、執行不同的method
  3. 回傳資料


  • express : 框架、骨幹